package com.atlin.cli.pattern;

/**
 * @author atlin
 * @description
 * @createDate 2024/9/23 9:38
 */
public class Client {
    public static void main(String[] args) {
        Device xiaomi = new Device("xiaomi");
        TurnOnCommand xmTurnOn = new TurnOnCommand(xiaomi);
        TurnOffCommand xmTurnOff = new TurnOffCommand(xiaomi);

        Device tv = new Device("TV");
        TurnOnCommand tvTurnOn = new TurnOnCommand(tv);
        TurnOffCommand tvTurnOff = new TurnOffCommand(tv);

        // 创建调用者
        RemoteController remote = new RemoteController();
        
        remote.setCommand(xmTurnOn);
        remote.pressButton();

        remote.setCommand(xmTurnOff);
        remote.pressButton();
        
        remote.setCommand(tvTurnOn);
        remote.pressButton();
        
    }
}
